// pages/messageDetail/messageDetail.js
var common = require("../../public.js");
Page({

    /**
     * 页面的初始数据
     */
    data: {
        detail:{},
        messageId:'',
        typeId:''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            messageId:options.messageId ? options.messageId :'',
            typeId:options.typeId ? options.typeId :''
        },()=>{
            this.mess_fn()
        })
    },
    // 消息详情
    mess_fn() {
        var that = this
        var tmp = {
            messageId:that.data. messageId
        }
        common.get('/userMessage/getUserMessageDetail', tmp, res => {
          if (res.status === 200) {
            res.data.createTime = that.time(res.data.createTime)
            res.data.orderCreateTime =that.time( res.data.orderCreateTime)
            res.data.paymentTime =that.time( res.data.paymentTime)
             that.setData({
                detail:res.data
             })
          } else {
            common.showRequestErrMsg(res)
          }
    
        })
      },
    // 封装时间控件方法
    time(time) {
        return common.dateFormat('yyyy-MM-dd HH:mm', time)
    },
   
})